﻿#Region "Imports"
Imports System.DirectoryServices
#End Region

Public Class IIsFile
    Implements IDisposable

#Region "Privates"

    Private _FileEntry As DirectoryEntry

#End Region

#Region "Constructors and Destructors"

    Public Sub New(ByVal FileEntry As DirectoryEntry)

        If FileEntry.SchemaClassName = FileSchemaClassName Then

            _FileEntry = FileEntry
            _FileEntry.RefreshCache()

        Else

            ConstructorEx(FileSchemaClassName)

        End If

    End Sub

    Protected Overrides Sub Finalize()

        If Not _FileEntry Is Nothing Then _FileEntry.Close()

    End Sub

    Public Sub Dispose() Implements IDisposable.Dispose

        If Not _FileEntry Is Nothing Then _FileEntry.Close()

    End Sub

#End Region

#Region "Properties"

    Public ReadOnly Property Name() As String
        Get

            Return _FileEntry.Name

        End Get
    End Property

    Public Property AccessPermissions() As AccessPermissionFlags
        Get

            Return GetProperty("AccessFlags", _FileEntry)

        End Get
        Set(ByVal value As AccessPermissionFlags)

            SetProperty("AccessFlags", value, _FileEntry)

        End Set
    End Property

    Public Property AuthenticationMethods() As AuthenticationFlags
        Get

            Return GetProperty("AuthFlags", _FileEntry)

        End Get
        Set(ByVal value As AuthenticationFlags)

            SetProperty("AuthFlags", value, _FileEntry)

        End Set
    End Property

#End Region

#Region "Public Functions and Methods"



#End Region

End Class
